{include file="header.html"}
<body class="gr">

<div class="navBar">
	<a class="left" href="javascript:history.back()"><i class="return"></i></a>
	<div class="titleView">编辑收货地址</div>
</div>

<div class="address-info main-top">
	<form action="api.php?app=address&act=edit_address" method="post">
	<input type="hidden" name="goalert" value="修改成功" />
	<input type="hidden" name="gourl" value="wap.php?app=address&act=list_address" />
	<input type="hidden" name="id" value="{$data->id}" />
	<ul class="tableView">
		<li>
			<h1>
				<div class="row">
					<span>收货人姓名</span>
					<input type="text" name="contactman" id="contactman" value="{$data->contactman}" />
				</div>
			</h1>
		</li>
		<li>
			<h1>
				<div class="row">
					<span>手机号码</span>
					<input type="tel" name="mobile" id="mobile" value="{$data->mobile}" />
				</div>
			</h1>
		</li>
		<li>
			<h1 class="push-ico">
				<div class="row">
					<span>所在地区</span>
					<div class="selects selects-x">
						<div>{$data->province}{if $data->province!=$data->city}{$data->city}{/if}{$data->district}</div>
						<select name="province" id="province" onchange="changeProvince({ province:'#province',city:'#city',district:'#district',applyName:true })"></select>
						<select name="city" id="city" onchange="changeCity({ city:'#city',district:'#district',applyName:true })"></select>
						<select name="district" id="district"></select>
					</div>
				</div>
			</h1>
		</li>
		<li>
			<h1>
				<div class="row">
					<span>地址</span>
					<input type="text" name="address" id="address" value="{$data->address}" />
				</div>
			</h1>
		</li>
	</ul>
	</form>
	<div class="buttonView">
		<a class="btn" href="javascript:void(0)">确定</a>
	</div>
</div>

{include file="footer.html"}
<script type="text/javascript" src="js/city.js"></script>
<script>
$(function(){
	$('#contactman').placeholder('请输入收货人姓名');
	$('#mobile').placeholder('请输入手机号码');
	$('#address').placeholder('请输入地址');
	// $('#idcard').placeholder('请输入身份证号码');
	$('.buttonView .btn').click(function(){
		if (!$('#contactman').val() || !$('#mobile').val() || !$('#address').val() || !$('.selects-x').text()) {
			$.overloadError('请填写完整');
			return;
		}
		$('form').submit();
	});
	
	tipShow = false;
	showCity({ province:'#province', city:'#city', district:'#district', applyName:true, provincename:'{$data->province}', cityname:'{$data->city}', districtname:'{$data->district}' });
	$('.address-info .selects').onclick(function(){
		$.actionpicker({
			title : '请选择地区',
			rightBtn : {
				text : '确定',
				click : function(){
					$('.selects').append(this.find('select'));
					$.actionpicker();
				}
			},
			before : function(){
				this.append($('.selects').find('select'));
				this.selectpicker({
					cls : 'areapicker',
					autoWidth : false,
					select : function(component, row){
						var html = comboCity($('#province').selected().val(), $('#city').selected().val(), $('#district').selected().val());
						$('.address-info .selects').addClass('selects-x');
						$('.address-info .selects div').html(html);
					},
					complete : function(){
						var html = comboCity($('#province').selected().val(), $('#city').selected().val(), $('#district').selected().val());
						$('.address-info .selects').addClass('selects-x');
						$('.address-info .selects div').html(html);
					}
				}, this.find('#province'), this.find('#city'), this.find('#district'));
			},
			close : function(){
				$('.selects').append(this.find('select'));
			}
		});
	});
});
</script>